//
//  CLViewController.m
//  UMengPods
//
//  Created by zhouchenglong on 04/27/2025.
//  Copyright (c) 2025 zhouchenglong. All rights reserved.
//

#import "CLViewController.h"
#import <WXApi.h>
#import <UMShare/UMShare.h>
#import <TencentOpenAPI/QQApiInterface.h>

@interface CLViewController ()

@end

@implementation CLViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)pay {
    NSString *partnerid = @"";
    NSString *prepayid = @"";
    NSString *packageValue = @"";
    NSString *timestamp = @"";
    NSString *noncestr = @"";
    NSString *sign = @"";
    
    PayReq *req             = [[PayReq alloc] init];
    req.partnerId           = partnerid;
    req.prepayId            = prepayid;
    req.nonceStr            = noncestr;
    req.timeStamp           = [timestamp intValue];
    req.package             = packageValue;
    req.sign                = sign;
    [WXApi sendReq:req completion:^(BOOL success) { }];
}
- (void)login {
    BOOL isWXAppInstalled = [WXApi isWXAppInstalled];
    BOOL isQQInstalled = [QQApiInterface isQQInstalled];
    
    UMSocialPlatformType platformType = UMSocialPlatformType_WechatSession;
    [[UMSocialManager defaultManager] getUserInfoWithPlatform:platformType currentViewController:nil completion:^(id result, NSError *error) {
            if (error) {
                NSLog(@"=========%@",error);
            } else
            {
                UMSocialUserInfoResponse *resp = result;
                // 授权信息
                NSLog(@"uid: %@", resp.uid);
                NSLog(@"openid: %@", resp.openid);
                NSLog(@"accessToken: %@", resp.accessToken);
                NSLog(@"expiration: %@", resp.expiration);
                // 用户信息
                NSLog(@"name: %@", resp.name);
                NSLog(@"iconurl: %@", resp.iconurl);
                NSLog(@"gender: %@", resp.gender);
                // 第三方平台SDK源数据
                NSLog(@"originalResponse: %@", resp.originalResponse);
            }
        }];
}

@end
